home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 October / PCWorld_2006-10_cd.bin / v cisle / pdffc / ps2pdf995.exe / pdf995 / res / convert / dumphint.ps < prev    next >
Text File  |  2004-09-16  |  21KB  |  757 lines

  1. % Copyright (C) 2000, 2001 Aladdin Enterprises.  All rights reserved.
  2. % This software is provided AS-IS with no warranty, either express or
  3. % implied.
  4. % This software is distributed under license and may not be copied,
  5. % modified or distributed except as expressly authorized under the terms
  6. % of the license contained in the file LICENSE in this distribution.
  7. % For more information about licensing, please refer to
  8. % http://www.ghostscript.com/licensing/. For information on
  9. % commercial licensing, go to http://www.artifex.com/licensing/ or
  10. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
  12.  
  13. % $Id: dumphint.ps,v 1.1.4.2 2004/09/15 19:55:54 ray Exp $
  14. % Linearized PDF hint formatting utility.
  15.  
  16. %
  17. % Linearized PDF hints generated by Acrobat suite seem to deviate from
  18. % the published specification.
  19. %
  20. % /P (page offset hint table) key in hint stream is not generated by
  21. % Adobe products. The key is no longer required in PDF 1.5.
  22. %
  23. % Per-page items 4 and 5 of the page offset hint table start from 1st
  24. % page rather than 2nd page as the spec claims.
  25. %
  26. % All array entries start from the new byte boundary.
  27. %
  28.  
  29. /table_width 79 def 
  30. /col1_width  66 def
  31.  
  32. % Skip bits to the next byte boundary
  33. /bytealign {        % <stream> bytealign -
  34.   begin /N 0 def /B 0 def end
  35. } bind def
  36.  
  37. % Set bit stream position and align it to byte boundary
  38. /set_align {            % <<>> pos set_align -
  39.   exch begin
  40.   S exch setfileposition
  41.   /N 0 def /B 0 def
  42.   end
  43. } bind def
  44.  
  45. % Read requested number of bits from the bit stream.
  46. /bitread {        % <bstream> <width> bitwrite <value>
  47.   exch begin
  48.   0                     %  bit val
  49.   { 
  50.     1 index N .min      %  bit val m
  51.     dup 3 1 roll        %  bit m val m 
  52.     bitshift            %  bit m val<<m
  53.     B 2 index N sub     %  bit m val<<m B m-N
  54.     bitshift add        %  bit m val<<m+B>>(N-m)
  55.     3 -1 roll           %  m val' bit 
  56.     2 index sub         %  m val' bit'
  57.     3 -1 roll           %  val' bit' m
  58.     N exch sub dup      %  val' bit' N' N'
  59.     1 exch bitshift     %  val' bit' N' 1<<N'
  60.     1 sub B and         %  val' bit' N' B&(1<<N')
  61.     /B exch def         %  val' bit' N'
  62.     /N exch def         %  val' bit'
  63.     dup 0 le {
  64.       pop exit          %  val'
  65.     } if
  66.     /N N 8 add def
  67.     /B B 8 bitshift S read not { 0 ( *** EOF! *** ) = } if add def
  68.     exch
  69.   } loop                %  bit' val'
  70.   end
  71. } bind def
  72.  
  73. % Print a string several times
  74. /multiprint {           % cnt (s) multiprint -
  75.   exch { dup print } repeat pop
  76. } bind def
  77.  
  78. % Split the line into 2 substrings.
  79. /split_line {           % (s) split_line () ()
  80.   dup length col1_width gt {
  81.     col1_width 1 sub
  82.     dup -1 0 {
  83.       dup               % (s) w i i
  84.       3 index           % (s) w i i ()
  85.       exch get          % (s) w i c
  86.       32 eq {
  87.         exch pop exit
  88.       } if
  89.       pop
  90.     } for
  91.     1 add               % (s) w'
  92.     1 index exch        % (s) (s) w'
  93.     0 exch              % (s) (s) 0 w'
  94.     getinterval         % (s) (v)
  95.   } {
  96.     dup                 % (s) (s)
  97.   } ifelse                  
  98.   (\n) search {
  99.     4 1 roll            % (pre) (s) (post) (match)
  100.     pop pop             % (pre) (s)
  101.     1 index length      % (pre) (s) len
  102.     1 add               % (pre) (s) len+1
  103.   } {
  104.     exch                % (pre) (s)
  105.     1 index length      % (pre) (s) len
  106.   } ifelse
  107.   1 index length        % (pre) (s) len Len
  108.   1 index sub           % (pre) (s) len Len-len
  109.   getinterval           % (pre) (post)
  110. } bind def
  111.  
  112. % Print a 2 column table. The string is printed in 1st column
  113. % left-aligned. The number is printed in 2nd column right-aligned.
  114. /two_column {           % n () two_column -
  115.   split_line            % n (a) ()
  116.   3 1 roll              % () n (a)
  117.   dup length            % () n (a) len
  118.   exch print            % () n len
  119.   exch =string cvs      % () len (n)
  120.   dup length            % () len (n) len2
  121.   3 -1 roll add         % () (n) len+len2 
  122.   //table_width         % () (n) len+len2 78
  123.   exch sub              % () (n) 78-len+len2 
  124.   ( ) multiprint        % () (n)
  125.   =                     % ()
  126.   { dup length 0 eq { exit } if
  127.     split_line exch =
  128.   } loop
  129.   pop
  130.   () =
  131. } bind def
  132.  
  133. % Print the header of a hint table
  134. /table_header {               % () table_header -
  135.   dup length dup
  136.   table_width exch sub 2 idiv % () len sp
  137.   dup ( ) multiprint          % () len sp
  138.   3 -1 roll =                 % len sp
  139.   ( ) multiprint              % len
  140.   (=) multiprint
  141.   ()= ()=
  142. } bind def
  143.  
  144. % Pretty-print an array on top level
  145. /dump_array {               % [ ] dump_array -
  146.   ([) = ( ) print
  147.   1 exch {
  148.     =string cvs         % pos ()
  149.     dup length dup      % pos () len len
  150.     3 index add 1 add   % pos () len len+pos+1
  151.     table_width gt {
  152.       () =
  153.       (  ) print        % pos () len
  154.       2 add             % pos () pos'
  155.       3 1 roll print pop % pos'
  156.     } {
  157.       ( ) print         % pos () len
  158.       exch print        % pos len
  159.       add 1 add         % pos'
  160.     } ifelse
  161.   } forall
  162.   pop
  163.   () = (]) =
  164. } bind def
  165.  
  166. % Pretty-print an array on 2nd level
  167. /dump_array2 {             % [ ] dump_array2 -
  168.   (  [) print
  169.   3 exch {
  170.     =string cvs            % pos ()
  171.     dup length dup         % pos () len len
  172.     3 index add 1 add      % pos () len len+pos+1
  173.     table_width 2 sub gt {
  174.       () =
  175.       (    ) print         % pos () len
  176.       4 add                % pos () pos'
  177.       3 1 roll print pop   % pos'
  178.     } {
  179.       ( ) print            % pos () len
  180.       exch print           % pos len
  181.       add 1 add            % pos'
  182.     } ifelse
  183.   } forall
  184.   pop
  185.   ( ]) =
  186. } bind def
  187.  
  188. % Print an array header
  189. /array_header {
  190.   () = =
  191. } bind def
  192.  
  193. % Analyze the page offset hint table.
  194. /dump_page_offset_table {  % - dump_page_offset_table -
  195.   hint_stream
  196.     
  197.   dup 32 bitread
  198.   dup /hint_minnop exch def
  199.   (1. The least number of objects in a page.) two_column
  200.  
  201.   dup 32 bitread
  202.   dup /hint_1st_obj exch def
  203.   (2. Location of the first page's page object.) two_column
  204.  
  205.   dup 16 bitread
  206.   dup /hint_maxnopbits exch def
  207.   (3. Bits for difference between max and min number of page objects.) two_column
  208.  
  209.   dup 32 bitread
  210.   dup /hint_minpl exch def
  211.   (4. Least length of a page.) two_column
  212.  
  213.   dup 16 bitread
  214.   dup /hint_maxplbits exch def
  215.   (5. Bits for difference between max and min length of a page.) two_column
  216.  
  217.   dup 32 bitread
  218.   dup /hint_minsco exch def
  219.   (6. Least start of Contents offset. ) 
  220.   1 index 0 ne { (\n*** Acrobat expects 0 ***) concatstrings } if
  221.   two_column
  222.  
  223.   dup 16 bitread
  224.   dup /hint_maxscobits exch def
  225.   (7. Bits for difference between max and min offset to the start of the content stream.) two_column
  226.  
  227.   dup 32 bitread
  228.   dup /hint_mincl exch def
  229.   (8. Least contents length.) two_column
  230.  
  231.   dup 16 bitread
  232.   dup /hint_maxclbits exch def
  233.   (9. Bits needed to represent the greatest Contents length.) two_column
  234.  
  235.   dup 16 bitread
  236.   dup /hint_maxsorbits exch def
  237.   (10. Bits needed to represent the greatest number of Shared Object references.) two_column
  238.  
  239.   dup 16 bitread
  240.   dup /hint_sobits exch def
  241.   (11. Bits needed to identify a Shared Object.) two_column
  242.  
  243.   dup 16 bitread
  244.   dup /hint_numfbits exch def
  245.   (12. Bits needed to represent numerator of fraction.) two_column
  246.  
  247.   dup 16 bitread
  248.   dup /hint_denf exch def
  249.   (13. Denominator of fraction.) two_column
  250.  
  251.   pop 
  252.  
  253.   LinearizationParams /N get
  254.  
  255.   % 1. Number of objects in the page.
  256.   hint_stream bytealign
  257.   /hint_page_obj [
  258.     2 index {
  259.       hint_stream hint_maxnopbits bitread
  260.       hint_minnop add
  261.     } repeat
  262.   ] readonly def
  263.  
  264.   (1. Number of objects on the page) array_header
  265.   hint_page_obj dump_array
  266.  
  267.   % 2, Page length in bytes.
  268.   hint_stream bytealign
  269.   /hint_page_len [
  270.     2 index {
  271.       hint_stream hint_maxplbits bitread
  272.       hint_minpl add
  273.     } repeat
  274.   ] readonly def
  275.  
  276.   (2. Page length in bytes.) array_header
  277.   hint_page_len dump_array
  278.  
  279.   % 3, Number of shared objects referenced from the page
  280.   hint_stream bytealign
  281.   /hint_page_sobj [
  282.     2 index {
  283.       hint_stream hint_maxsorbits bitread
  284.     } repeat
  285.   ] readonly def
  286.  
  287.   (3. Number of shared objects referenced from the page.) array_header
  288.   hint_page_sobj dump_array
  289.  
  290.   % 4. Index into the shared objects hint table
  291.   hint_stream bytealign
  292.   /hint_page_sobj_id [
  293.     0 1 4 index 1 sub {
  294.       hint_page_sobj exch get [
  295.         exch {
  296.           hint_stream hint_sobits bitread
  297.         } repeat
  298.       ] readonly
  299.     } for
  300.   ] readonly def
  301.  
  302.   (4. Index into the shared objects hint table.) array_header
  303.   ([) =
  304.   hint_page_sobj_id { dump_array2 } forall
  305.   (])=
  306.  
  307.   % 5. Fractional position for each shared object reference
  308.   hint_stream bytealign
  309.   /hint_page_sobj_pos [
  310.     0 1 4 index 1 sub {
  311.       hint_page_sobj exch get [
  312.         exch {
  313.           hint_stream hint_numfbits bitread
  314.           hint_denf div
  315.         } repeat
  316.       ] readonly
  317.     } for
  318.   ] readonly def
  319.  
  320.   (5. Fractional position for each shared object reference. ) array_header
  321.   ([)=
  322.   hint_page_sobj_pos { dump_array2 } forall
  323.   (])=
  324.  
  325.   % 6. Offset of the page's content stream from the beginning of the page.
  326.   hint_stream bytealign
  327.   /hint_page_content_offset [
  328.     2 index {
  329.       hint_stream hint_maxscobits bitread
  330.       hint_minsco add
  331.     } repeat
  332.   ] readonly def
  333.  
  334.   (6. Offset of the page's content stream from the beginning of the page.) array_header
  335.   hint_page_content_offset dump_array
  336.  
  337.   % 7. Length of the page's content stream in bytes.
  338.   hint_stream bytealign
  339.   /hint_page_content_len [
  340.     2 index {
  341.       hint_stream hint_maxclbits bitread
  342.       hint_mincl add
  343.     } repeat
  344.   ] readonly def
  345.  
  346.   (7. Length of the page's content stream in bytes.) array_header
  347.   hint_page_content_len dump_array
  348.  
  349.   pop
  350. } bind def
  351.  
  352. % Analyze tha shared object hint table
  353. /dump_shared_object_table { 
  354.   hint_stream
  355.     
  356.   dup 32 bitread
  357.   dup /shint_1st_obj_id exch def
  358.   (1. Object number of the first object in the shared objects section) two_column
  359.  
  360.   dup 32 bitread
  361.   dup /shint_1st_obj_pos exch def
  362.   (2. Location of the first object in the shared objects section.) two_column
  363.  
  364.   dup 32 bitread
  365.   dup /shint_1st_shared exch def
  366.   (3. The number of shared object entries for the first page.) two_column
  367.  
  368.   dup 32 bitread
  369.   dup /shint_all_shared exch def
  370.   (4. Number of shared object entries for the shared objects section including 1st page.) two_column
  371.  
  372.   dup 16 bitread
  373.   dup /shint_group_bits exch def
  374.   (5. Number of bits needed to represent the greatest number of objects in a shared object group.) two_column
  375.  
  376.   dup 32 bitread
  377.   dup /shint_group_least_sz exch def
  378.   (6. Least length of a shared object group in bytes.) two_column
  379.  
  380.   dup 16 bitread
  381.   dup /shint_group_diff_bits exch def
  382.   (7. Bits for the difference between the greatest and least length of a shared object group size.)  two_column
  383.   pop
  384.  
  385.   (1. length of the object group in bytes.) array_header
  386.   hint_stream bytealign
  387.   /shint_group_sz [
  388.     shint_all_shared {
  389.       hint_stream shint_group_diff_bits bitread
  390.       shint_group_least_sz add
  391.     } repeat
  392.   ] readonly def
  393.  
  394.   shint_group_sz dump_array
  395.  
  396.   (2. MD5 signature flag) array_header
  397.     hint_stream bytealign
  398.     /shint_md5_flags
  399.     [ shint_all_shared 
  400.       { hint_stream 1 bitread
  401.       } repeat
  402.     ] readonly def
  403.  
  404.     shint_md5_flags dump_array
  405.  
  406.     (3. MD5 signature string) array_header
  407.     false shint_md5_flags { 0 ne or } forall { 
  408.       shint_md5_flags {
  409.         0 eq {
  410.           (<>)=
  411.         } {
  412.           hint_stream /S get 128 string
  413.           readstring pop
  414.           dup length 128 eq {
  415.             ==
  416.           } { pop (Error reading nd5 string.) ==
  417.           } ifelse
  418.         } ifelse
  419.       } forall   
  420.     } {
  421.       () = (none) =
  422.     } ifelse
  423.  
  424.     (4. The number of objects in the group.) array_header
  425.     hint_stream bytealign
  426.     /shint_group_cnt [
  427.       shint_all_shared {
  428.         hint_stream shint_group_bits bitread
  429.       } repeat
  430.     ] readonly def
  431.  
  432.     shint_group_cnt dump_array
  433.  
  434.   } bind def
  435.  
  436. % Analyze the thumbnail hint table.
  437. /dump_thumbnail_table {
  438.   hint_stream
  439.  
  440.   dup 32 bitread
  441.   dup /thint_1st_obj_id exch def
  442.   (1. Object number of the first thumbnail image.) two_column
  443.  
  444.   dup 32 bitread
  445.   dup /thint_1st_obj_pos exch def
  446.   (2. Location of the first thumbnail image.) two_column
  447.  
  448.   dup 32 bitread
  449.   dup /thint_page_cnt exch def
  450.   (3. Number of pages that have thumbnail images.) two_column
  451.  
  452.   dup 16 bitread
  453.   dup /thint_no_thumbnail_bits exch def
  454.   (4. Bits for the max number of consecutive pages without a thumbnail image.) two_column
  455.  
  456.   dup 32 bitread
  457.   dup /thint_min_sz exch def
  458.   (5. The least length of a thumbnail image in bytes.) two_column
  459.  
  460.   dup 15 bitread
  461.   dup /thint_obj_sz_bits exch def
  462.   (6. Bits for the difference between max and min length of a thumbnail image.) two_column
  463.  
  464.   dup 32 bitread
  465.   dup /thint_min_obj_cnt exch def
  466.   (7. The least number of objects in a thumbnail image.) two_column
  467.  
  468.   dup 16 bitread
  469.   dup /thint_obj_cnt_bits exch def
  470.   (8. Bits for the difference between max and min number of objects in a thumbnail image.) two_column
  471.  
  472.   dup 32 bitread
  473.   dup /thint_1st_shared_obj exch def
  474.   (9. First object in the thumbnail shared objects section.) two_column
  475.  
  476.   dup 32 bitread
  477.   dup /thint_1st_shared_pos exch def
  478.   (10. Location of the first object in the thumbnail shared objects section.) two_column
  479.  
  480.   dup 32 bitread
  481.   dup /thint_shared_cnt exch def
  482.   (11. Number of thumbnail shared objects.) two_column
  483.  
  484.   dup 32 bitread
  485.   dup /thint_shared_section_sz exch def
  486.   (12. Length of the thumbnail shared objects section in bytes.) two_column
  487.  
  488.   pop
  489.   LinearizationParams /N get
  490.  
  491.   (1. The number of preceding pages lacking a thumbnail image.) array_header
  492.   hint_stream bytealign
  493.   /thint_no_thumbnail_pages [
  494.     2 index {
  495.       hint_stream thint_no_thumbnail_bits bitread
  496.     } repeat
  497.   ] readonly def
  498.  
  499.   thint_no_thumbnail_pages dump_array
  500.  
  501.   (2. Number of objects in this page's thumbnail image.) array_header
  502.   hint_stream bytealign
  503.   /thint_page_obj_cnt [
  504.     2 index {
  505.       hint_stream thint_obj_cnt_bits bitread
  506.       thint_min_obj_cnt add
  507.     } repeat
  508.   ] readonly def
  509.  
  510.   thint_page_obj_cnt dump_array
  511.  
  512.   (3. Length of this page's thumbnail image in bytes.) array_header
  513.   hint_stream bytealign
  514.   /thint_page_obj_sz [
  515.     2 index {
  516.       hint_stream thint_obj_sz_bits bitread
  517.       thint_min_sz add
  518.     } repeat
  519.   ] readonly def
  520.  
  521.   thint_page_obj_sz dump_array
  522.   pop
  523. } bind def
  524.  
  525. % Analyze the generic hint table.
  526. % The hint field names are re-used. 
  527. /dump_generic_table { 
  528.   hint_stream
  529.  
  530.   dup 32 bitread
  531.   dup /ghint_1st_obj exch def
  532.   (1. Object number of the first object in the group.) two_column
  533.  
  534.   dup 32 bitread
  535.   dup /ghint_1st_obj_pos exch def
  536.   (2. Location of the first object in the group.) two_column
  537.  
  538.   dup 32 bitread
  539.   dup /ghint_obj_cnt exch def
  540.   (3. Number of objects in the group.) two_column
  541.  
  542.   dup 32 bitread
  543.   dup /ghint_group_sz exch def
  544.   (4. Length of the object group in bytes.) two_column
  545.  
  546.   pop
  547. } bind def
  548.  
  549. % Analyze the interactive hint table.
  550. % The hint field names are re-used.
  551. /dump_interactive_table {
  552.   hint_stream
  553.  
  554.   dup 32 bitread
  555.   dup /ihint_1st_obj exch def
  556.   (1. Object number of the first object in the group.) two_column
  557.  
  558.   dup 32 bitread
  559.   dup /ihint_1st_obj_pos exch def
  560.   (2. Location of the first object in the group.) two_column
  561.  
  562.   dup 32 bitread
  563.   dup /ihint_obj_cnt exch def
  564.   (3. Number of objects in the group.) two_column
  565.  
  566.   dup 32 bitread
  567.   dup /ihint_group_sz exch def
  568.   (4. Length of the object group in bytes.) two_column
  569.  
  570.   dup 32 bitread
  571.   dup /ihint_shared_cnt exch def
  572.   (5. Number of shared object references.) two_column
  573.  
  574.   dup 16 bitread
  575.   dup /ihint_shared_obj_bits exch def
  576.   (6. Bits for the max shared object id used by the interactive form or the logical structure hierarchy.)
  577.   1 index hint_sobits ne {
  578.     (\n*** This fiels is not equal to max shared object ID bits ***) concatstrings 
  579.   } if
  580.  
  581.   pop
  582.  
  583.   (7. Shared object identifier.) array_header
  584.   hint_stream bytealign
  585.   /ihint_shared_obj_id [
  586.     ihint_shared_cnt {
  587.       hint_stream hint_sobits bitread
  588.     } repeat
  589.   ] readonly def
  590.  
  591.   ihint_shared_obj_id dump_array
  592. } bind def
  593.  
  594. % Enumerate all documented hint tables.
  595. /dump_all_tables {  % <<stream>> dump_all_tables -
  596.   (Page offset hint table) table_header
  597.   hint_stream 0 set_align
  598.   dump_page_offset_table
  599.  
  600.   (S, Shared object hint table) table_header
  601.   dup /S .knownget {
  602.     hint_stream exch set_align
  603.     dump_shared_object_table
  604.   } {
  605.     (Required table is not found.) error_msg
  606.   } ifelse
  607.  
  608.   dup /T .knownget {
  609.     (T, Thumbnail hint table) table_header
  610.     hint_stream exch set_align
  611.     dump_thumbnail_table
  612.   } if   
  613.  
  614.   dup /O .knownget {
  615.     (O, Outline hint table) table_header
  616.     hint_stream exch set_align
  617.     dump_generic_table
  618.   } if
  619.  
  620.   dup /A .knownget {
  621.     (A, Thread information hint table) table_header 
  622.     hint_stream exch set_align
  623.     dump_generic_table
  624.   } if
  625.  
  626.   dup /E .knownget {
  627.     (E, Named destination hint table) table_header
  628.     hint_stream exch set_align
  629.     dump_generic_table
  630.   } if
  631.  
  632.   dup /V .knownget {
  633.     (V, Interactive form hint table) table_header
  634.     hint_stream exch set_align
  635.     dump_interactive_table
  636.   } if
  637.  
  638.   dup /I .knownget {
  639.     (I, Information dictionary hint table) table_header
  640.     hint_stream exch set_align
  641.     dump_generic_table
  642.   } if
  643.  
  644.   dup /C .knownget {
  645.     (C, Logical structure hint table) table_header
  646.     hint_stream exch set_align
  647.     dump_interactive_table
  648.   } if
  649.  
  650.   dup /L .knownget {
  651.     (L, Page label hint table) table_header
  652.     hint_stream exch set_align
  653.     dump_generic_table
  654.   } if
  655.  
  656.     pop
  657. } bind def
  658.  
  659.  
  660. % Load PDF file and extract the hint stream.
  661. /pdf_dump_hints {                             % <infile> pdf_dump_hints -
  662.   dup (r) file                                % fname
  663.   false exch                                  % fname F file 
  664.   {
  665.     dup 7 string readstring pop               % fname F file ()
  666.     (%PDF-1.) ne { pop exit } if              % fname F file
  667.     dup 0 setfileposition
  668.     dup token not { pop exit } if             % fname F file obj
  669.     dup type /integertype ne { pop exit } if  % fname F file obj
  670.     1 index token not { pop pop exit } if     % fname F file obj gen
  671.     dup type /integertype ne {pop pop exit}if % fname F file obj gen
  672.     4 2 roll                                  % fname obj gen F file
  673.     dup 0 setfileposition
  674.     exch true or                              % fname obj gen file T
  675.     exit
  676.   } loop
  677.   {
  678.     pdfdict begin
  679.     pdfopenfile dup begin
  680.     40 dict begin
  681.     /IDict exch def
  682.     .setsafe
  683.  
  684.     % Read all objects into memory.
  685.     Trailer touch
  686.     resolveR                                  % fname <<>>
  687.     dup /Linearized known {
  688.       dup /L get                              % fname <<>> Len
  689.       3 -1 roll status not { 0 0 0 0 } if     % <<>> Len
  690.       pop pop exch pop                        % <<>> Len len
  691.       eq {
  692.         /LinearizationParams exch def
  693.         LinearizationParams /H get
  694.         dup length 2 eq {
  695.           0 get PDFoffset add PDFfile exch setfileposition
  696.           PDFfile token pop 
  697.           PDFfile token pop
  698.           resolveR dup true resolvestream
  699.           /ReusableStreamDecode filter 
  700.           bitstream dup bytealign
  701.           /hint_stream exch def
  702.  
  703.           dump_all_tables
  704.         } {
  705.           pop
  706.           (Overflow hint stream is not supported.) =
  707.         } ifelse
  708.       } {
  709.         pop
  710.         (Wrong file length in linearization dictionary.) =
  711.       } ifelse
  712.     } {
  713.       pop (The file is not linearized.) =
  714.     } ifelse
  715.     end        % temporary dict
  716.     end        % IDict
  717.     end
  718.   } {
  719.     pop
  720.     (Input file is not a valid PDF file.) =
  721.   } ifelse
  722. } bind def
  723.  
  724. % Initial setup
  725. /dump_hints {
  726.   counttomark 1 eq {
  727.     exch pop
  728.     save exch
  729.     3000000 setvmthreshold
  730.     pdfoptdict begin 
  731.     pdf_dump_hints
  732.     end
  733.     restore
  734.     true
  735.   } {
  736.     cleartomark false
  737.   } ifelse
  738. } bind def
  739.  
  740. /shellarguments {false} def
  741. (pdfopt.ps) runlibfile
  742. currentdict /shellarguments undef
  743.  
  744. % Check for command line arguments.
  745. mark shellarguments {
  746.   dump_hints not {
  747.     (Usage: gs -dNODISPLAY  -- dumphint.ps input.pdf) = flush
  748.   } if
  749. } {
  750.   pop
  751. } ifelse
  752.  
  753. % EOF
  754.